import React,{memo} from 'react'
import { Avatar } from 'antd'

function CheckboxList(props, ref){
  console.log( props.props.checked)
  const itemsFu = (obj)=>{
      obj.checked = !obj.checked;
    let item = new Date().getTime();
      obj.key =obj.uid + item
    props.onCheckbox(obj);

  }

  return <>
       <div onClick={()=>itemsFu(props.props)}  className="check-item">
         <div className="icon">
           {
             props.props.checked === true ?
               <i className="iconfont mt-roundcheckfill"></i> :
               <i className="iconfont mt-round"></i>
           }
         </div>
         <div className="check-img">
           <Avatar size={30} src={ props.props.avatar} />
         </div>
         <div className="check-text">
           {props.props.label}
         </div>
       </div>
  </>
}

export default  memo(CheckboxList);
